<template>
  <div>
    <a-card :bordered='false'>
      <f-search-form :more='true' @searchHandler='searchHandler' :tableObj='tableObj' :show-export-btn='true'
                     export-url='exportUrl2'>
        <f-search-form-item label='部门名称' ref='dept' name='deptId' type='select' valueKey='deptId' label-key='deptName'
                            style='width:220px' />
        <f-search-form-item label='订单编号' name='orderNo' style='width: 250px' />
        <f-search-form-item label='回款日期' name='orderNo' style='width: 250px' />
      </f-search-form>
      <f-table ref='table' rowKey='orderDetailsId' :showSetting='true' :tableColumns='columns' :scroll='{x:true}'
               :multiple='false' :operator='operator' :params='queryParam' :api='api.saleDayStatistic'
               handler=''>
      </f-table>
    </a-card>
  </div>
</template>
<script>
import api from '../../js/api'

export default {
  name: 'ProfitTab2',
  components: {},
  data() {
    let me = this
    //操作按钮
    let operator = []
    let customFlag = this.$store.state.user.customFlag
    return {
      api: Object.assign(api, this.api),
      //列表初始化查询参数
      queryParam: {
        // companyId:this.$store.state.user.companyId
        companyId: 100,
        beginDate: '2023-09-20',
        endDate: '2023-09-26'
      },
      tableObj: null,
      superAdmin: this.superAdmin,
      // 表头
      columns: [
        {
          title: '序号',
          width: '70px',
          align: 'center',
          fixed: 'left',
          customRender: (text, record, index) => index + 1
        },
        {
          title: '部门名称',
          align: 'left',
          width: '130px',
          dataIndex: 'deptName'
        },
        {
          title: '商品名称',
          align: 'left',
          width: '130px',
          dataIndex: 'drugsName'
        },
        {
          title: '规格',
          align: 'left',
          width: '130px',
          dataIndex: 'drugsSpec'
        }],
      columnsEnd: [{
        title: '数量合计',
        align: 'left',
        width: '130px',
        dataIndex: 'numTotal'
      },
        {
          title: '含税金额合计',
          align: 'center',
          width: '130px',
          dataIndex: 'priceTotal'
        }
      ],
      operator: operator
    }
  },
  created() {
  },
  mounted() {
    this.tableObj = this.$refs.table
    this.$nextTick(() => {
      this.initHead()
    })

  },
  methods: {
    initHead() {
      this.http.get(this, {
        url: this.api.saleDayStatistic.head,
        params: {
          beginDate:"2023-09-20",
          endDate:"2023-09-26",

        },
        success: function(me, data) {
          me.$nextTick(() => {
            me.columns = me.columns.concat(data).concat(me.columnsEnd)

            console.log('me.columns',me.columns)

          })
        }
      })

     }
  }
}
</script>
